home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1988 July & August
/
rerun-1988-07-08.d64
/
travel tally
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
223 lines
10 rem business trip by kenny lawson
20 forx=1to10:reada$:cn$(x)=a$:next
30 forx=828to935:reada:pokex,a:next
40 w1$=" ":w2$=w1$+"[144] "
50 w3$="[144]"+right$(w1$,30):mm$=" "+chr$(18)+chr$(129)+mid$(w1$,3,18)+"[146] "
60 w4$="[156] ":w5$=w4$+"[144] ":dy=0:fi$="expense.sq"
70 w6$=left$(w3$,23):ch$="chooseanoption":sv=0:dimz$(23)
80 forx=1to10:forc=1to16-len(cn$(x)):cn$(x)=cn$(x)+chr$(32):nextc
90 cn$(x)=chr$(32)+cn$(x):nextx:dl$="[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
100 l1$="[175][175][146]":l2$="[185][185][146]":l3$="[162][162][146]":l4$="[184][184][146]":l5$="[183][183][146]"
110 bc$=" [146][145][157][157]":ta$=" "
120 ta(1)=9:forx=2to10:ta(x)=ta(x-1)+3:next
130 co$(1)="":co$(2)="[156]":co$(3)="":co$(4)="":co$(5)="[154]"
140 co$(6)="[129]":co$(7)="[149]":co$(8)="[153]":co$(9)="[150]":co$(10)="[151]"
150 open15,8,15:open8,8,8,fi$+",s,r":input#15,er$:bb$="0":ed=0
160 ifval(er$)<19thenclose8:close15:goto190
170 print#15,"uj":forx=1to2000:next:close15
180 close8:open8,8,8,fi$+",s,w":forx=1to10:print#8,bb$:next:close8:close15
190 printchr$(30)chr$(147):poke53280,15:poke53281,15
200 print"[129][207][180]"tab(37)"[170][208]"
210 print"[208][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][207]"
220 forx=1to20:print"[167]"tab(38)"[180]":next
230 print"[186][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][204]"
240 print"[204][180]"tab(37)"[170][186]";
250 printchr$(19):print:print:print"[129]business diary and expense chart"
260 printtab(8)mm$:printtab(8)" main menu [146] "
270 forx=1to2:printtab(8)mm$:next:printtab(8)" 1. load the file [146] "
280 printtab(8)" 2. save the file [146] "
290 printtab(8)" 3. enter amounts [146] "
300 printtab(8)" 4. see bar chart [146] "
310 printtab(8)" 5. check totals [146] "
320 printtab(8)" 6. exit program [146] "
330 forx=1to4:printtab(8)mm$:next:print"[145][145][145]"
340 printtab(11)ch$:geta$
350 ifa$<>""then370
360 forx=1to300:next:print"[145][145]":printtab(8)mm$"[145]":forx=1to300:next:goto340
370 a=val(a$):ifa<1ora>6then360
380 onagoto690,790,400,1100,1560,1670
390 rem get category inputs
400 poke53280,14:poke53281,14:printchr$(159)chr$(147)chr$(17)
410 a$=chr$(18)+chr$(32):printtab(11);:forx=1to19:printa$;:next:print
420 forx=1to21:printtab(11)a$spc(17)a$:next
430 printtab(11);:forx=1to19:printa$;:next:printchr$(19):forx=1to3:print:next
440 forx=1to10:printtab(12)cn$(x)chr$(17):next
450 print"":printtab(12)chr$(18)cn$(1)
460 print""tab(32)"use the"
470 print" business"tab(32)"cursor":print" diary"tab(32)"keys to"
480 print" and"tab(32)"move":print" expense":printtab(32)"return"
490 print" chart":printtab(34)"to":printtab(32)"select"
500 printtab(32)"<m> for":printtab(33)"menu":poke214,3:print
510 geta$:ifa$=""then510
520 ifa$="m"then190
530 ifa$<>chr$(17)then590
540 gosub870:ifcn=10then570
550 print:printchr$(145)tab(12)cn$(cn)chr$(17)
560 printtab(12)chr$(18)cn$(cn+1);:goto510
570 print:printchr$(145)tab(12)cn$(cn):poke214,3:print:printtab(12)""cn$(1);
580 goto510
590 ifa$<>chr$(145)then650
600 gosub870:ifcn=1then630
610 print:printchr$(145)tab(12)cn$(cn):poke214,sn-3:print
620 printtab(12)chr$(18)cn$(cn-1);:goto510
630 print:printchr$(145)tab(12)cn$(1):poke214,21:print
640 printtab(12)chr$(18)cn$(10);:goto510
650 ifa$<>chr$(13)then510
660 gosub870:ro=peek(214):sys828:rem save screen
670 gosub980:rem input routine
680 goto510
690 rem load file
700 gosub770:rem draw window
710 printtab(9)"[156][145]loading"fi$:gosub1410:rem read disk status
720 close8:open8,8,8,"expense.sq,s,r"
730 forx=1to10:input#8,cs$(x):cn(x)=val(cs$(x)):next:close8
740 forx=1to10:ifcn(x)<>0thendy=1
750 next
760 gosub1410:goto250
770 print"":printtab(9)w4$:forx=1to3:printtab(9)w5$:next
780 printtab(10)w6$"[145][145][145][145]":return
790 rem save file
800 open15,8,15,"s0:bus.seq.del"
810 gosub770:printtab(10)"[156][145]saving"fi$
820 gosub1410:open15,8,15,"r0:bus.seq.del="+fi$
830 gosub1410:open15,8,15,"s0:"+fi$
840 gosub1410:close8:open8,8,8,fi$+",s,w"
850 forx=1to10:cs$(x)=str$(cn(x)):print#8,cs$(x):next
860 gosub1410:sv=1:goto250
870 rem check peek
880 sn=peek(214):ifsn=4thencn=1:return
890 ifsn=6thencn=2:return
900 ifsn=8thencn=3:return
910 ifsn=10thencn=4:return
920 ifsn=12thencn=5:return
930 ifsn=14thencn=6:return
940 ifsn=16thencn=7:return
950 ifsn=18thencn=8:return
960 ifsn=20thencn=9:return
970 cn=10:return
980 rem input routine
990 gosub1470:tp$="":printchr$(31);
1000 poke204,0:getd$:ifd$=""then1000
1010 ifd$="."then1050
1020 ifd$=chr$(13)then1050
1030 ifd$>"/"andd$<":"then1050
1040 wait207,1:poke204,1:gosub1790:gosub1510:goto990
1050 ifd$<>chr$(13)thentp$=tp$+d$:printd$;:goto1000
1060 wait207,1:poke204,1
1070 cn(cn)=cn(cn)+val(tp$):printchr$(159):ifcn(cn)<>0thendy=1
1080 sys882:poke214,ro-1:print:iftp$<>""thened=1
1090 return
1100 rem draw bar chart
1110 ifdythen1140
1120 gosub1790:gosub770:printtab(9)"[156]no data in categories"
1130 forx=1to2000:next:goto250
1140 poke53280,0:poke53281,0:printchr$(30)chr$(147);
1150 hi=0:forx=1to10:ifcn(x)>hithenhi=int(cn(x))
1160 next
1170 ifhi/20<>int(hi/20)thenhi=hi+1:goto1170
1180 in=int(hi/20):sa=hi-in
1190 forx=sato0step-in:print"$ "x;tab(8)dl$:next
1200 printtab(9)"d e h m p s t g t v"
1210 print"category i n t s h u a r r m"
1220 printtab(9)"n t l c o p x a a t"
1230 print" working....please wait "
1240 pn=in/6:forx=1to10:ch(x)=int(cn(x)/in):cl(x)=cn(x)-ch(x)*in
1250 ifcl(x)=0thenpb$(x)="":goto1320
1260 ifcl(x)=<pnthenpb$(x)=l1$:goto1320
1270 ifcl(x)=<pn*2thenpb$(x)=l2$:goto1320
1280 ifcl(x)=<pn*3thenpb$(x)=l3$:goto1320
1290 ifcl(x)=<pn*4thenpb$(x)=l4$:goto1320
1300 ifcl(x)=<pn*5thenpb$(x)=l5$:goto1320
1310 ch(x)=ch(x)+1
1320 next
1330 forx=1to10:lt=0:poke214,18:print:printtab(ta(x));
1340 ifch(x)=0then1360
1350 forct=1toch(x):printco$(x)bc$;:next
1360 printco$(x)pb$(x):next
1370 poke214,23:print:print" would you like a printout? (y/n) "
1380 geta$:ifa$="y"then1850
1390 ifa$<>"n"then1380
1400 goto190
1410 rem check disk status
1420 close15:open15,8,15:input#15,v$,w$,x$,y$
1430 ifval(v$)<19thenclose15:return
1440 gosub1790
1450 printtab(10)"[156]diskerror:":printtab(10)""w$:forx=1to2000:next
1460 print#15,"uj":forx=1to1000:next:close15:goto250
1470 rem draw window 1
1480 print"":printtab(5)w1$:forx=1to6:printtab(5)w2$:next
1490 printtab(6)w3$"[145][145][145][145][145][145][145]":printtab(6)"entertoday'stotalamount"
1500 printtab(6)"for"cn$(cn):printchr$(17)tab(8)"$";:return
1510 rem draw window 2
1520 print"":printtab(9)w4$:forx=1to3:printtab(9)w5$:next
1530 printtab(10)w6$"[145][145][145][145][145][156]":printtab(10)"useonlynumbersor"
1540 printtab(11)"decimalpoint(.)"
1550 printtab(10)"re-entertheamount":forx=1to2500:next:return
1560 rem display totals
1570 poke53281,5:poke53280,5:poke646,13:printchr$(147):gt=0
1580 forx=1to10:printtab(5)cn$(x)tab(25)"$";:gosub1630:gt=gt+cn(x)
1590 printspc(9-le)le$:print:next
1600 print"total expenses= $";:le$=str$(gt):le=len(le$):gosub1640
1610 printle$tab(26)"press any key[146]";:poke198,0
1620 wait198,1:poke198,0:goto190
1630 le$=str$(cn(x)):le=len(le$)
1640 ifmid$(le$,le-1,1)="."thenle$=le$+"0":le=le+1
1650 ifval(le$)=int(val(le$))thenle$=le$+".00":le=le+3
1660 return
1670 rem exit program
1680 gosub1790:gosub770:printtab(10)"[156]quit? are you sure?"
1690 printtab(17)"(y/n)":poke198,0
1700 geta$:ifa$="n"then250
1710 ifa$<>"y"then1700
1720 ifsv=1ored=0then1770
1730 gosub1790:gosub770:printtab(11)"[156]changes not saved":poke198,0
1740 printtab(11)"still quit? (y/n)"
1750 geta$:ifa$="n"then250
1760 ifa$<>"y"then1750
1770 poke53280,14:poke53281,6:poke646,14:printchr$(